package ui.provider;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import atempdao.EgnRstScenarioDao;


import dao.*;

public class ScenarioContent implements ITreeContentProvider{
	private final static Logger logger = LoggerFactory.getLogger(ScenarioContent.class);

	private int level =1;
	private List<String> list= new ArrayList<String>();

	@Override
	public void dispose() {
	}

	@Override
	public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
	}

	@Override
	public Object[] getElements(Object inputElement) {
		return EgnRstScenarioDao.getEgnRstScenaioSetId().toArray();
	}

	@Override
	public Object[] getChildren(Object parentElement) {
		List<EgnRstScenario> rst= new ArrayList<EgnRstScenario>();
		if( parentElement instanceof String){
			String sceSetId = (String)parentElement;
			return EgnRstScenarioDao.getEgnRstScenarioId(sceSetId).toArray();
		}	
		else return null;
	}

	@Override
	public Object getParent(Object element) {
		return null;
	}

	@Override
	public boolean hasChildren(Object element) {
		if(element instanceof String){
			return true;
		}
		else return false;
	}
	
//	@Override
//	public void addListenerTo(){
//	}


}
